package com.tenentia.pcmps.swm.business.implementation;

import org.apache.log4j.Logger;

import com.tenentia.pcmps.swm.business.BusinessLogicException;
import com.tenentia.pcmps.swm.business.interfaces.ParametersManager;
import com.tenentia.pcmps.swm.data.DataAccessObjectsFactory;
import com.tenentia.pcmps.swm.data.beans.Parameter;
import com.tenentia.pcmps.swm.data.interfaces.BonusDAO;
import com.tenentia.pcmps.swm.data.interfaces.ParametersDAO;

/**
 * 
 * @author tEnEntia, S.L.N.E.
 * 
 */
public class ParametersManagerImpl implements ParametersManager {

	private static final Logger LOGGER = Logger.getLogger(ParametersManagerImpl.class.getPackage().getName());
	
	public ParametersManagerImpl() {
		super();
	}
	
	@Override
	public Parameter getAvailableParameterByName(Parameter parameter)	throws BusinessLogicException {
		ParametersDAO parametersDAO;
		try {
			parametersDAO = (ParametersDAO) DataAccessObjectsFactory.getInstance().createNewDataAccessObject(DataAccessObjectsFactory.PARAMETERS_DAO);
			return parametersDAO.getAvailableParameterByName(parameter);
		} catch (Exception e) {
			LOGGER.error(e, e);
			throw new BusinessLogicException(e);
		}
	}

}
